
use DTA/Datos_ENIA_95_07_Processed.dta, clear

gen above = totmuj>=20

local Descleg dlegprop dlegdirect dlegtesp dlegadmin dlegcoms dlegnocald dlegnocali dlegmant dlegserv dleaux
egen Dlegtot = rowtotal(`Descleg')
local Aporpatr aporcoms aporadmin apordirect aporprop apoaux aporserv aportesp aponocald
egen Aporpatr = rowtotal(`Aporpatr')

egen Totwages = rowtotal(rempag Dlegtot Aporpatr)
gen Totwages_L = Totwages*inf/(tottrab*1000)
gen va_L = va*inf/(tottrab*1000)
gen frac_women=totmuj/(tothom+totmuj)

* SAMPLE USED IN THE ESTIATIONS
keep if totmuj >= 5 & totmuj <= 35 // & tottrab >= 10

global Descriptive_Stats totmuj tothom frac_women wage kl elecl combl yw

label var totmuj "Female Workers"
label var tothom "Male Workers"
label var frac_women "Fraction of female workers
label var wage "Wage per Worker"
label var kl "Capital per Worker"
label var elecl "Electricity Consumption per Worker"
label var combl "Fuel Consumption per Worker"
label var yw "Production per Worker"

forvalues k = 0/1 {
foreach var of varlist totmuj $Descriptive_Stats {
sum `var' if above == `k'
local `var'_all`k': di %12.3fc r(mean)
sum `var' if period==1 & above == `k'
local `var'_t1`k': di %12.3fc r(mean)
sum `var' if period==2 & above == `k'
local `var'_t2`k': di %12.3fc r(mean)
sum `var' if period==3 & above == `k'
local `var'_t3`k': di %12.3fc r(mean)
sum `var' if sectorA==1 & above == `k'
local `var'_sa`k': di %12.3fc r(mean)
sum `var' if sectorA==0 & above == `k'
local `var'_sb`k': di %12.3fc r(mean)
sum `var' if large==0 & above == `k'
local `var'_sm`k': di %12.3fc r(mean)
sum `var' if large==1 & above == `k'
local `var'_lg`k': di %12.3fc r(mean)
}
count if above == `k'
local N_all`k': di %12.0fc r(N)
count if period==1 & above == `k'
local N_t1`k': di %12.0fc r(N)
count if period==2 & above == `k'
local N_t2`k': di %12.0fc r(N)
count if period==3 & above == `k'
local N_t3`k': di %12.0fc r(N)
count if sectorA==1 & above == `k'
local N_sa`k': di %12.0fc r(N)
count if sectorA==0 & above == `k'
local N_sb`k': di %12.0fc r(N)
count if large==0 & above == `k'
local N_sm`k': di %12.0fc r(N)
count if large==1 & above == `k'
local N_lg`k': di %12.0fc r(N)
}

texdoc init TABLES/Table3_description.tex, replace force
tex \begin{tabular}{lccccccccc} \toprule
tex &  All  & 95-07 & 99-02 & 03-07 & Sector A & Sector B & Small & Large \\
tex &  (1)  &  (2)  &  (3)  &  (4)  &   (5)    &   (6)    &  (7)  &  (8)  \\ \midrule
foreach var of varlist $Descriptive_Stats {
tex \multicolumn{5}{l}{`: var label `var''} & \\
tex \quad Below & ``var'_all0' & ``var'_t10' & ``var'_t20' & ``var'_t30' & ``var'_sa0' & ``var'_sb0' & ``var'_sm0' & ``var'_lg0' \\ 
tex \quad Above & ``var'_all1' & ``var'_t11' & ``var'_t21' & ``var'_t31' & ``var'_sa1' & ``var'_sb1' & ``var'_sm1' & ``var'_lg1' \\ 
}
tex \multicolumn{5}{l}{Observations} & \\
tex \quad Below & `N_all0' & `N_t10' & `N_t20' & `N_t30' & `N_sa0' & `N_sb0' & `N_sm0' & `N_lg0' \\ 
tex \quad Above & `N_all1' & `N_t11' & `N_t21' & `N_t31' & `N_sa1' & `N_sb1' & `N_sm1' & `N_lg1' \\ 
tex \bottomrule
tex \end{tabular}
texdoc close

